package com.gexiaobao.pigeon.app.util;

import android.util.Log;

import org.osmdroid.tileprovider.tilesource.OnlineTileSourceBase;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.tileprovider.tilesource.XYTileSource;
import org.osmdroid.util.MapTileIndex;

/**
 * @Author : hxw
 * @Date : 2024/12/30 14:30
 * @Describe :
 */
public class LayerTileSources  extends TileSourceFactory {

    //谷歌卫星混合
    public static final OnlineTileSourceBase GoogleHybrid = new XYTileSource("Google-Hybrid",
            0, 19, 512, ".png", new String[]{
            "http://mt0.google.cn",
            "http://mt1.google.cn",
            "http://mt2.google.cn",
            "http://mt3.google.cn",

    }) {
        @Override
        public String getTileURLString(long pMapTileIndex) {
            Log.d("url", getBaseUrl() + "/vt/lyrs=y&scale=2&hl=zh-CN&gl=CN&src=app&x=" + MapTileIndex.getX(pMapTileIndex) + "&y=" + MapTileIndex.getY(pMapTileIndex) + "&z=" + MapTileIndex.getZoom(pMapTileIndex));
            return getBaseUrl() + "/vt/lyrs=y&scale=2&hl=zh-CN&gl=CN&src=app&x=" + MapTileIndex.getX(pMapTileIndex) + "&y=" + MapTileIndex.getY(pMapTileIndex) + "&z=" + MapTileIndex.getZoom(pMapTileIndex);
        }
    };

    //谷歌卫星
    public static final OnlineTileSourceBase GoogleSat = new XYTileSource("Google-Sat",
            0, 19, 512, ".png", new String[]{
            "http://mt0.google.cn",
            "http://mt1.google.cn",
            "http://mt2.google.cn",
            "http://mt3.google.cn",

    }) {
        @Override
        public String getTileURLString(long pMapTileIndex) {

            return getBaseUrl() + "/vt/lyrs=s&scale=2&hl=zh-CN&gl=CN&src=app&x=" + MapTileIndex.getX(pMapTileIndex) + "&y=" + MapTileIndex.getY(pMapTileIndex) + "&z=" + MapTileIndex.getZoom(pMapTileIndex);

        }
    };
    //谷歌地图
    public static final OnlineTileSourceBase GoogleRoads = new XYTileSource("Google-Roads",
            0, 18, 512, ".png", new String[]{
            "http://mt0.google.cn",
            "http://mt1.google.cn",
            "http://mt2.google.cn",
            "http://mt3.google.cn",

    }) {
        @Override
        public String getTileURLString(long pMapTileIndex) {
            return getBaseUrl() + "/vt/lyrs=m&scale=2&hl=zh-CN&gl=CN&src=app&x=" + MapTileIndex.getX(pMapTileIndex) + "&y=" + MapTileIndex.getY(pMapTileIndex) + "&z=" + MapTileIndex.getZoom(pMapTileIndex);
        }
    };
    //谷歌地形
    public static final OnlineTileSourceBase GoogleTerrain = new XYTileSource("Google-Terrain",
            0, 16, 512, ".png", new String[]{
            "http://mt0.google.cn",
            "http://mt1.google.cn",
            "http://mt2.google.cn",
            "http://mt3.google.cn",

    }) {
        @Override
        public String getTileURLString(long pMapTileIndex) {
            return getBaseUrl() + "/vt/lyrs=t&scale=2&hl=zh-CN&gl=CN&src=app&x=" + MapTileIndex.getX(pMapTileIndex) + "&y=" + MapTileIndex.getY(pMapTileIndex) + "&z=" + MapTileIndex.getZoom(pMapTileIndex);
        }
    };
    //谷歌地形带标注
    public static final OnlineTileSourceBase GoogleTerrainHybrid = new XYTileSource("Google-Terrain-Hybrid",
            0, 16, 512, ".png", new String[]{
            "http://mt0.google.cn",
            "http://mt1.google.cn",
            "http://mt2.google.cn",
            "http://mt3.google.cn",

    }) {
        @Override
        public String getTileURLString(long pMapTileIndex) {
            return getBaseUrl() + "/vt/lyrs=p&scale=2&hl=zh-CN&gl=CN&src=app&x=" + MapTileIndex.getX(pMapTileIndex) + "&y=" + MapTileIndex.getY(pMapTileIndex) + "&z=" + MapTileIndex.getZoom(pMapTileIndex);
        }
    };

    /*******【上面的谷歌地图无法使用】*********/

    //高德地图
    public static final OnlineTileSourceBase AutoNaviVector = new XYTileSource("AutoNavi-Vector",
            0, 20, 256, ".png", new String[]{
            "https://wprd01.is.autonavi.com/appmaptile?",
            "https://wprd02.is.autonavi.com/appmaptile?",
            "https://wprd03.is.autonavi.com/appmaptile?",
            "https://wprd04.is.autonavi.com/appmaptile?",

    }) {
        @Override
        public String getTileURLString(long pMapTileIndex) {
            Log.d("url", getBaseUrl() + "x=" + MapTileIndex.getX(pMapTileIndex) + "&y=" + MapTileIndex.getY(pMapTileIndex) + "&z="
                    + MapTileIndex.getZoom(pMapTileIndex) + "&lang=zh_cn&size=1&scl=1&style=7&ltype=7");
            return getBaseUrl() + "x=" + MapTileIndex.getX(pMapTileIndex) + "&y=" + MapTileIndex.getY(pMapTileIndex) + "&z="
                    + MapTileIndex.getZoom(pMapTileIndex) + "&lang=zh_cn&size=1&scl=1&style=7&ltype=7";
        }
    };

    // 天地图申请的tk值
    private static String TK = "&tk=18473b68472260f386fd13174d2cd568";
    //天地图-有标注电子地图 _W是墨卡托投影  _c是国家2000的坐标系
    public static OnlineTileSourceBase TDTCIA_W = new XYTileSource("Tian Di Tu CIA",
            0, 20, 256, "",
            new String[]{"http://t0.tianditu.com/DataServer?T=cia_w" + TK,
                    "http://t1.tianditu.com/DataServer?T=cia_w" + TK,
                    "http://t2.tianditu.com/DataServer?T=cia_w" + TK,
                    "http://t3.tianditu.com/DataServer?T=cia_w" + TK,
                    "http://t4.tianditu.com/DataServer?T=cia_w" + TK,
                    "http://t5.tianditu.com/DataServer?T=cia_w" + TK,
                    "http://t6.tianditu.com/DataServer?T=cia_w" + TK,
                    "http://t7.tianditu.com/DataServer?T=cia_w" + TK
            }) {
        @Override
        public String getTileURLString(final long pMapTileIndex) {
            Log.d("url", getBaseUrl() + "&X=" + MapTileIndex.getX(pMapTileIndex) + "&Y=" + MapTileIndex.getY(pMapTileIndex)
                    + "&L=" + MapTileIndex.getZoom(pMapTileIndex));
            return getBaseUrl() + "&X=" + MapTileIndex.getX(pMapTileIndex) + "&Y=" + MapTileIndex.getY(pMapTileIndex)
                    + "&L=" + MapTileIndex.getZoom(pMapTileIndex);
        }
    };


    // 天地图-影像地图 _W墨卡托投影 _c国家2000的坐标系
    public static final OnlineTileSourceBase TDTIMG_W = new XYTileSource("Tian Di Tu IMG",
            0,20,256,"",
            new String[]{"http://t0.tianditu.com/DataServer?T=img_w"+TK,
                    "http://t1.tianditu.com/DataServer?T=img_w"+TK,
                    "http://t2.tianditu.com/DataServer?T=img_w"+TK,
                    "http://t3.tianditu.com/DataServer?T=img_w"+TK,
                    "http://t4.tianditu.com/DataServer?T=img_w"+TK,
                    "http://t5.tianditu.com/DataServer?T=img_w"+TK,
                    "http://t6.tianditu.com/DataServer?T=img_w"+TK,
                    "http://t7.tianditu.com/DataServer?T=img_w"+TK}) {

        @Override
        public String getTileURLString(long pMapTileIndex) {
            Log.d("url", getBaseUrl() + "&X=" + MapTileIndex.getX(pMapTileIndex) + "&Y=" + MapTileIndex.getY(pMapTileIndex)
                    + "&L=" + MapTileIndex.getZoom(pMapTileIndex));
            return getBaseUrl() + "&X=" + MapTileIndex.getX(pMapTileIndex) + "&Y=" + MapTileIndex.getY(pMapTileIndex)
                    + "&L=" + MapTileIndex.getZoom(pMapTileIndex);
        }

    };


    // 天地图-电子地图 _W墨卡托投影 _c国家2000的坐标系
    public static final OnlineTileSourceBase TDTVEC_W = new XYTileSource("Tian Di Tu VEC",
            0,20,256,"",
            new String[]{"http://t0.tianditu.com/DataServer?T=vec_w"+TK,
                    "http://t1.tianditu.com/DataServer?T=vec_w"+TK,
                    "http://t2.tianditu.com/DataServer?T=vec_w"+TK,
                    "http://t3.tianditu.com/DataServer?T=vec_w"+TK,
                    "http://t4.tianditu.com/DataServer?T=vec_w"+TK,
                    "http://t5.tianditu.com/DataServer?T=vec_w"+TK,
                    "http://t6.tianditu.com/DataServer?T=vec_w"+TK,
                    "http://t7.tianditu.com/DataServer?T=vec_w"+TK}) {

        @Override
        public String getTileURLString(long pMapTileIndex) {
            return getBaseUrl() + "&X=" + MapTileIndex.getX(pMapTileIndex) + "&Y=" + MapTileIndex.getY(pMapTileIndex)
                    + "&L=" + MapTileIndex.getZoom(pMapTileIndex);
        }

    };

    // 天地图-地形图 _W墨卡托投影 _c国家2000的坐标系
    public static final OnlineTileSourceBase TDTTER_W = new XYTileSource("Tian Di Tu TER",
            0,20,256,"",
            new String[]{"http://t0.tianditu.com/DataServer?T=ter_w"+TK,
                    "http://t1.tianditu.com/DataServer?T=ter_w"+TK,
                    "http://t2.tianditu.com/DataServer?T=ter_w"+TK,
                    "http://t3.tianditu.com/DataServer?T=ter_w"+TK,
                    "http://t4.tianditu.com/DataServer?T=ter_w"+TK,
                    "http://t5.tianditu.com/DataServer?T=ter_w"+TK,
                    "http://t6.tianditu.com/DataServer?T=ter_w"+TK,
                    "http://t7.tianditu.com/DataServer?T=ter_w"+TK}) {

        @Override
        public String getTileURLString(long pMapTileIndex) {
            return getBaseUrl() + "&X=" + MapTileIndex.getX(pMapTileIndex) + "&Y=" + MapTileIndex.getY(pMapTileIndex)
                    + "&L=" + MapTileIndex.getZoom(pMapTileIndex);
        }

    };

}
